﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataSet1TableAdapters;
using System.IO;
using System.Collections;
using System.Xml;
using System.Data;
using System.Configuration;

public partial class EditZinas : System.Web.UI.Page
{
    DisplayTableAdapter DisplayTa = new DisplayTableAdapter();
    DataSet1.DisplayDataTable DispayDs = new DataSet1.DisplayDataTable();
    DataSet1.RakstiDataTable RakstiAll = new DataSet1.RakstiDataTable();

    RakstiTableAdapter RakstsEditTa = new RakstiTableAdapter();
    DataSet1.RakstiDataTable RakstsEditDs = new DataSet1.RakstiDataTable();
    RakstiTableAdapter RakstiTa = new RakstiTableAdapter();
    DataSet1.RakstiDataTable RakstiDa = new DataSet1.RakstiDataTable();
    
    DisplayTableAdapter DisplayEditTa = new DisplayTableAdapter();
    DataSet1.DisplayDataTable DispayEditDs = new DataSet1.DisplayDataTable();

    SadalaTableAdapter SadalaEditTa = new SadalaTableAdapter();
    DataSet1.SadalaDataTable SadalaEditDs = new DataSet1.SadalaDataTable();


    string[] KomentFaili ={ "RakstuComenti.xml",
                                "FotoKomentari.xml",
                                "LVvideo.xml",
                                "BikeCheckKomentari.xml",
                            "InternationalVideo.xml"};
      string upPath = "";
      public ArrayList img_name = new ArrayList();
      ArrayList img_path = new ArrayList();
      ArrayList img_small_path = new ArrayList();
    protected void Page_Load(object sender, EventArgs e)
      {
          //    if (User.Identity.IsAuthenticated == false)
          //    { Server.Transfer("login_aizliegts.aspx"); }
          //    else
          //    {
          if (!IsPostBack)
          {
              RakstsEditDs = RakstsEditTa.GetData();

              SadalaEditDs = SadalaEditTa.GetData(); // Uztaisa Checkbox Listu :D
              CheckBoxList1.DataSource = SadalaEditDs;
              CheckBoxList1.DataTextField = "cat_name";
              CheckBoxList1.DataValueField = "Sadalas_nameID";
              CheckBoxList1.DataBind();
              //   CheckBoxList1.AutoPostBack = true;
              CheckBoxList1.RepeatColumns = 1;
              CheckBoxList1.RepeatDirection = RepeatDirection.Vertical;
              CheckBoxList1.RepeatLayout = RepeatLayout.Flow;

              //DDLFolders bind
              String folderPathXml = ConfigurationManager.AppSettings["GalleryFolders"];
              List<String> folderPaths = new List<string>();
              folderPaths.AddRange(folderPathXml.Split(';'));
              folderPaths.Add("~/pics/");
              DDLFolders.DataSource = folderPaths;
              DDLFolders.DataBind();

              populateListBildesMape();
          }
          else
          {
              string ctrlname = Request.Params.Get("__EVENTTARGET");
              if (ctrlname.Equals("DDLFolders"))
              populateListBildesMape();
          }          
      }

    protected void populateListBildesMape()
    {
        string virtualPathDir = Server.MapPath(DDLFolders.SelectedValue); // atrod virtual path lapas Bāzes MAPI
        string[] dirrAray = Directory.GetDirectories(virtualPathDir); // nolasa visas servera Mapes
        string[] FOlderList = new string[dirrAray.Length];

        for (int i = 0; i < dirrAray.Length; i++)
        {
            FOlderList[i] = dirrAray[i].Substring(dirrAray[i].LastIndexOf("\\") + 1);
        }
        // Array PicFolder = new Arr
        DropDownListBildesMape.DataSource = FOlderList;
        DropDownListBildesMape.DataBind();
    }

    protected void ButtonSaveNewRaksts_Click(object sender, EventArgs e)
    {
        RakstsEditDs = RakstsEditTa.GetData();
        int RakstaPedejāsRindasNR = RakstsEditDs.Rows.Count;
        string TestDoubleSAVE = RakstsEditDs[RakstaPedejāsRindasNR - 1].Virsraksts;
        if (TestDoubleSAVE != TextBoxVirsraksts.Text)
        {
            string VirsrakstTest = TextBoxVirsraksts.Text;
            string virsrakstURL = VirsrakstLinks(VirsrakstTest);
            string decode_URL = DecodeVirsr_URL(virsrakstURL);
            if (VirsrakstTest == decode_URL)
            {
                upPath = Server.MapPath("~/pics") + "\\" + DropDownListBildesMape.SelectedValue + "\\";

                Dzinejs Dz = new Dzinejs();
                Dz.Bildes_Show_Mape = "pics/" + DropDownListBildesMape.SelectedValue + "/";
                string Smallimg = "";
                string OriginalaBilde = "";
                if (TextBox1_imgURL.Text != "")
                {
                    Smallimg = TextBox1_imgURL.Text;
                }
                else if (FileField.HasFile == true)
                {
                    Smallimg = Dz.MakeMeAGoodThumbnail(upPath, FileField.FileContent, FileField.FileName, 0, 150); // Funkcija Uztaisa MAZO bildi un saglabā uz Servaka
                    OriginalaBilde = Dz.IstaisBildesString;
                }
                string SmallText = Dz.MakeShortText(TextBoxNewRaksts.Text, 200);

                RakstsEditDs.VirsrakstsColumn.MaxLength = 500;
                RakstsEditDs.SadaluListsColumn.MaxLength = 500;
                RakstsEditDs.bildeColumn.MaxLength = 500;
                RakstsEditDs.autorsColumn.MaxLength = 250;

                DispayEditDs = DisplayEditTa.GetData();
                SadalaEditDs = SadalaEditTa.GetData();
                int RakstaRindas_ID = RakstsEditDs[RakstaPedejāsRindasNR - 1].ID_name; // dabūn Pēdējā Raksta ID (vaig lai varētu uzģenerēt jaunu ID)
                int DisplayPēdējāRindasNR = DispayEditDs.Rows.Count;
                int DisplayRindas_ID = DispayEditDs[DisplayPēdējāRindasNR - 1].DisplayID;

                //string CheckBOXTextTest = "";
                string PiederošāsSadaļasTeksts = "";

                for (int i = 0; i < CheckBoxList1.Items.Count; i++)
                {
                    if (CheckBoxList1.Items[i].Selected == true)
                    {
                        PiederošāsSadaļasTeksts += SadalaEditDs[i].cat_name + " ";
                        DataSet1.DisplayRow JaunsDisplay = DispayEditDs.NewDisplayRow(); // Jaunā Display Rinda 
                        JaunsDisplay.DisplayID = DisplayRindas_ID + 1 + i;
                        JaunsDisplay.RakstaID = RakstaRindas_ID + 1;
                        JaunsDisplay.SadalasID = i + 1;
                        DispayEditDs.AddDisplayRow(JaunsDisplay);
                        //CheckBOXTextTest = " nospiestie Checkbox =" + Convert.ToString(i);
                    }
                }
                DataSet1.RakstiRow JaunsRaksts = RakstsEditDs.NewRakstiRow(); // Jaunā Raksta rindas rinda :)
                JaunsRaksts.ID_name = RakstaRindas_ID + 1;
               // JaunsRaksts.komentSkaits = 0;
                char[] RinduDalitajs = { '\n' };
                string[] RinduTeksts = TextBoxNewRaksts.Text.Split(RinduDalitajs);
                string jaunaisTeksts = "";
                for (int i = 0; i < RinduTeksts.Length; i++)
                {
                    if (RinduTeksts[i].Contains("<iframe") == true)
                    {
                        // ja ir <iframe vidaks ta izdzēš ārā "webkitAllowFullScreen mozallowfullscreen allowFullScreen"
                        int startIndex = RinduTeksts[i].IndexOf("webkitAllowFullScreen");
                        if (startIndex == 0)
                        {
                            startIndex = RinduTeksts[i].IndexOf("allowfullscreen");
                        }
                        int endIndex = RinduTeksts[i].IndexOf("></iframe>");
                        if (startIndex > 0)
                        {
                            string Jteksts = RinduTeksts[i].Remove(startIndex, endIndex - startIndex);
                            RinduTeksts[i] = Jteksts;
                        }
                    }
                    if (RinduTeksts[i].Contains("<br/>") == false)
                    {
                        jaunaisTeksts += RinduTeksts[i] + "<br/>";
                    }
                }
                JaunsRaksts.raksts = jaunaisTeksts; /// Lielais Teksts ar AUTO BR/> funkciju 
                JaunsRaksts.MazaisRaksts = SmallText; // mazais Teksts
                JaunsRaksts.SadaluLists = PiederošāsSadaļasTeksts; // Sadaļu nosaukumi
                JaunsRaksts.autors = TextBoxAutors.Text;  // Autors
                JaunsRaksts.bilde = OriginalaBilde;  // Lielā bilde 
                JaunsRaksts.bildeTumb = Smallimg;  // mazā Bilde
                JaunsRaksts.Virsraksts = TextBoxVirsraksts.Text; // Virstraksts
                JaunsRaksts.datums = System.DateTime.Today; // Datums

                RakstsEditDs.AddRakstiRow(JaunsRaksts); // add jauno Raksta Rundu
                RakstsEditTa.Update(RakstsEditDs); // Apdeito DatuBāzi
                RakstsEditTa.Fill(RakstsEditDs); // šeit Apdeito TableAdapteri (laikam priekš display
                DisplayEditTa.Update(DispayEditDs);
                DisplayEditTa.Fill(DispayEditDs);

                UpdateSitemap(); // Sitemap Update

                Label_ERROR.Text = ""; // No error
            }
            else
            {
                Label_ERROR.Text = "Nepareizs Virsraksta FOrmāts, izlabo kļūdu un megini vēl ! ";
            }

        }
    }

    protected void ButtonJaunaMape_Click(object sender, EventArgs e)
    {

        if (!Directory.Exists(Server.MapPath(DDLFolders.SelectedValue) + "\\" + TextBoxJaunaMape.Text + "\\"))
        {
            Directory.CreateDirectory(Server.MapPath(DDLFolders.SelectedValue) + "\\" + TextBoxJaunaMape.Text + "\\");            
            populateListBildesMape();
            if (DropDownListBildesMape.Items.FindByValue(TextBoxJaunaMape.Text)!=null)
            DropDownListBildesMape.SelectedValue = TextBoxJaunaMape.Text;
        }
        TextBoxJaunaMape.Text = "";
    }

    protected void Button_addIMG_Click(object sender, EventArgs e)
    {
        if (FileField.HasFile == true)
        {
            string fileName = FileField.FileName;
            img_name = Add_to_arrayList(fileName, Repeater1.Items.Count + 1, img_name, "img_name");

            string pathtext = DDLFolders.SelectedValue.Replace("~/","") + DropDownListBildesMape.SelectedValue + "/" + FileField.FileName;
            img_path = Add_to_arrayList(pathtext, Repeater1.Items.Count + 1, img_path, "img_path");

            pathtext = DDLFolders.SelectedValue.Replace("~/", "") + DropDownListBildesMape.SelectedValue + "/" + "Small" + FileField.FileName;
            img_small_path = Add_to_arrayList(pathtext, Repeater1.Items.Count + 1, img_small_path, "img_small_path");
            // Tālāk Saglabā bildi uz servera (savādāk to izdarīt nevar
            Dzinejs bildeNew = new Dzinejs();
            bildeNew.Bildes_Show_Mape = DDLFolders.SelectedValue + DropDownListBildesMape.SelectedValue + "/";
            upPath = Server.MapPath(DDLFolders.SelectedValue) + "\\" + DropDownListBildesMape.SelectedValue + "\\";
            bildeNew.MakeMeAGoodThumbnail(upPath, FileField.FileContent, FileField.FileName, 200, 0);

            Repeater1.DataSource = img_name;
            Repeater1.DataBind();
        }
    }
    protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        Button img_link_button = ((Button)e.Item.FindControl("Button1"));
        img_link_button.Text = ((string)img_name[e.Item.ItemIndex]);
    }

    protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        int Nr = e.Item.ItemIndex;
        img_path = ((ArrayList)ViewState["img_path"]);
        img_small_path = ((ArrayList)ViewState["img_small_path"]);
        TextBoxNewRaksts.Text += "<a id='bild' href='" + ((string)img_path[Nr]) + "' ><img src='" + ((string)img_small_path[Nr]) + "' style='border-width:0px;' /></a> ";
    }

    protected ArrayList Add_to_arrayList(object o, int Nr, ArrayList a, string o_name)
    {
        a = ((ArrayList)ViewState[o_name]);
        try
        {
            a.Add(o);
        }
        catch (NullReferenceException e_null)
        {
            a = new ArrayList(Nr);
            a.Add(o);
        }
        ViewState[o_name] = a;
        return a;
    }

    // Lejā ir Gridview4 kods
    protected void SqlDataSource4_Inserting(object sender, SqlDataSourceCommandEventArgs e)
    {

    }
    protected void GridViewInsert(object sender, EventArgs e)
    {
        SqlDataSource4.Insert();
    }
    void UpdateSitemap()
    {
        string virtualPathDir = Server.MapPath("~/");
        XmlTextWriter textWriter3 = new XmlTextWriter(virtualPathDir + "\\SiteMap.xml", System.Text.Encoding.UTF8);
        textWriter3.WriteStartDocument(); // Sākam rakstīt       
        textWriter3.Indentation = 4;
        textWriter3.WriteRaw("\n");
        textWriter3.WriteStartElement("urlset");
        textWriter3.WriteAttributeString("xmlns", "http://www.sitemaps.org/schemas/sitemap/0.9");
        textWriter3.WriteAttributeString(" xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
        //textWriter3.WriteRaw("\n \t\t\t\t"); // Newline starp atributes nestrādā
        textWriter3.WriteAttributeString("xsi:schemaLocation", "http://www.sitemaps.org/schemas/sitemap/0.9  http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd");

        RakstiDa = RakstiTa.GetDataBySortDatums(); // ir jau sasortēti pēc datuma. 
        foreach (DataSet1.RakstiRow Rr in RakstiDa)
        {
            DispayDs = DisplayTa.GetDataByRakstID(Rr.ID_name);
            bool Ir = false;
            if (DispayDs.Rows.Count > 0)
            {
                foreach (DataSet1.DisplayRow Dr in DispayDs)
                {
                    if ((Dr.SadalasID == 1) | (Dr.SadalasID == 2) | (Dr.SadalasID == 3) | (Dr.SadalasID == 4))
                    {
                        Ir = true;
                        break;
                    }
                }
            }
            if (Ir)
            {
                RakstiAll.Rows.Add(Rr.ItemArray);
            }
        }

        foreach (DataSet1.RakstiRow Srow in RakstiAll)
        {
            // Make Raksta Hiper linku
            string RakstaLinks = "DefaultZoom.aspx?value=" + VirsrakstLinks(Srow.Virsraksts);
            textWriter3.WriteRaw("\n \t\t");
            textWriter3.WriteStartElement("url");
            textWriter3.WriteRaw("\n \t\t\t\t");
            //   <loc>http://shop.parbmx.com/</loc>
            textWriter3.WriteStartElement("loc");
            textWriter3.WriteString("http://shop.parbmx.com/" + RakstaLinks); // NAME=FRAME
            textWriter3.WriteEndElement();
            //   <changefreq>weekly</changefreq>
            textWriter3.WriteRaw("\n \t\t\t\t");
            textWriter3.WriteStartElement("changefreq");
            textWriter3.WriteString("weekly");
            textWriter3.WriteEndElement();
            textWriter3.WriteRaw("\n \t\t");
            textWriter3.WriteEndElement();
        }
        RakstiAll.Rows.Clear();
        foreach (DataSet1.RakstiRow Rr in RakstiDa)
        {
            DispayDs = DisplayTa.GetDataByRakstID(Rr.ID_name);
            bool Ir = false;
            if (DispayDs.Rows.Count > 0)
            {
                foreach (DataSet1.DisplayRow Dr in DispayDs)
                {
                    if (Dr.SadalasID == 17)
                    {
                        Ir = true;
                        break;
                    }
                }
            }
            if (Ir)
            {
                RakstiAll.Rows.Add(Rr.ItemArray);
            }
        }

        foreach (DataSet1.RakstiRow Srow in RakstiAll)
        {
            // Make Raksta Hiper linku
            string RakstaLinks = "DefaultZoom.aspx?value=" + VirsrakstLinks(Srow.Virsraksts);

            textWriter3.WriteRaw("\n \t\t");
            textWriter3.WriteStartElement("url");
            textWriter3.WriteRaw("\n \t\t\t\t");
            //   <loc>http://shop.parbmx.com/</loc>
            textWriter3.WriteStartElement("loc");
            textWriter3.WriteString("http://shop.parbmx.com/" + RakstaLinks); // NAME=FRAME
            textWriter3.WriteEndElement();
            //   <changefreq>weekly</changefreq>
            textWriter3.WriteRaw("\n \t\t\t\t");
            textWriter3.WriteStartElement("changefreq");
            textWriter3.WriteString("weekly");
            textWriter3.WriteEndElement();
            textWriter3.WriteRaw("\n \t\t");
            textWriter3.WriteEndElement();
        }
        textWriter3.WriteRaw("\n");
        textWriter3.WriteEndElement();
        textWriter3.WriteEndDocument();
        textWriter3.Close();  
    }

    string VirsrakstLinks(string Virsraksts)
    {
        string Vr = Virsraksts;
        char[] SpaceDalitajs = { ' ' };

        string Vr_new = "";
        string Vr_line = "";
        if (Vr.Contains("-") == true)
        {
            string[] Paa = Vr.Split('-');
            Vr_line = Paa[0];
            for (int Pab = 1; Pab < Paa.Length; Pab++)
            {
                Vr_line += "--" + Paa[Pab];
            }
        }
        else { Vr_line = Vr; }
        string[] Vr_sadalits = Vr_line.Split(SpaceDalitajs);
        if (Vr_sadalits.Length != 1)
        {
            Vr_new = Vr_sadalits[0];
            for (int ii = 1; ii < Vr_sadalits.Length; ii++)
            {
                Vr_new += "-" + Vr_sadalits[ii];
            }
        }
        else { Vr_new = Vr_sadalits[0]; }
        return Vr_new;
    }
    protected void Button2_DeletArticle_Click(object sender, EventArgs e)
    {
        int DelArtId = Convert.ToInt32(TextBox1DeletID.Text);
        RakstsEditDs = RakstsEditTa.GetData();
        int i = 0;
        foreach (DataSet1.RakstiRow DelR in RakstsEditDs)
        {
            if (DelR.ID_name == DelArtId)
            {
                RakstsEditDs[i].Delete();
                RakstsEditTa.Update(RakstsEditDs); // Apdeito DatuBāzi
                RakstsEditTa.Fill(RakstsEditDs); // šeit Apdeito TableAdapteri (laikam priekš display
                break;
            }
            i++;
        }
        DispayEditDs = DisplayEditTa.GetData();
        i = 0;
        foreach (DataSet1.DisplayRow delDisplay in DispayEditDs)
        {
            if (delDisplay.RakstaID == DelArtId)
            {
                DispayEditDs[i].Delete();
            }
            i++;
        }
                DisplayEditTa.Update(DispayEditDs);
                DisplayEditTa.Fill(DispayEditDs);
    }

    string DecodeVirsr_URL(string URL_virsraksts)
    {
        string html_txt = URL_virsraksts;
        string Virsraksts = "";
        bool Svitra = false;
        int stringNR = 0;
        if (html_txt.Contains("--") == true)
        {
            stringNR = html_txt.LastIndexOf("--");
            Virsraksts = html_txt.Substring(0, stringNR);
            Virsraksts += html_txt.Substring(stringNR + 2);
            html_txt = Virsraksts;
            Virsraksts = "";
            Svitra = true;
        }

        if (html_txt.Contains("-") == true)
        {
            string[] Tsplit = html_txt.Split('-');

            for (int f = 0; f < Tsplit.Length; f++)
            {
                if (f == Tsplit.Length - 1)
                {
                    Virsraksts += Tsplit[f]; // Beigas Stringam ta neliek " " Space
                }
                else
                {
                    Virsraksts += Tsplit[f] + " ";
                }
            }
        }
        else
        { // Ja teksts ir prasts vārds BEZ (-) vai (--)
            Virsraksts = html_txt;
        }

        if (Svitra == true)
        {
            string Vs = "";
            Vs = Virsraksts.Substring(0, stringNR) + "-" + Virsraksts.Substring(stringNR);
            Virsraksts = Vs;
        }
        return Virsraksts;
    }

    protected void Button2koment_Click(object sender, EventArgs e)
    {
        // saliek visiem raksties Komentār Ciparus!. 
        // Pārfiltrē visus Rakstu ID uz komentāru Esamību! 
        DataTable koment = new DataTable("koment");
        DataColumn ID = new DataColumn("ID");
        ID.DataType = typeof(Int32);
        koment.Columns.Add(ID);
        DataColumn XQ = new DataColumn("count");
        XQ.DataType = typeof(int);
        koment.Columns.Add(XQ);
        //DataColumn autors = new DataColumn("autor");
        //autors.DataType = typeof(string);
        //koment.Columns.Add(autors);
        //DataColumn  tekstkom = new DataColumn("text");
        //tekstkom.DataType = typeof(string);
        //koment.Columns.Add(tekstkom);

        string virtualPathDir = Server.MapPath("~/");
        foreach( string failVards in KomentFaili)
        {
            XmlTextReader Sadalla = new XmlTextReader(virtualPathDir + failVards);
            XmlDocument Comment = new XmlDocument();
            Comment.Load(Sadalla);
            Sadalla.Close();
            XmlNode RakstuKomentari = Comment.ChildNodes[2];
            //  int RakstuKom_Count = RakstuKomentari.ChildNodes.Count;
            foreach (XmlNode xmlRaksts in RakstuKomentari.ChildNodes)
            {
                DataRow kom = koment.NewRow();
                kom["ID"] = Convert.ToInt32(xmlRaksts.Attributes["ID"].Value);
                XmlNode Xkom = xmlRaksts.ChildNodes[0];
                kom[1] = Xkom.ChildNodes.Count;
                koment.LoadDataRow(kom.ItemArray,true);
            }
        }

        for (int i = 0; i < koment.Rows.Count; i++)
        {
            //if (koment.Rows[i].RowState != DataRowState.Deleted) // Ja Rinda Nav dzēsta
            //{
                for(int b=0;b< koment.Rows.Count;b++)
                {
                    //if (koment.Rows[b].RowState != DataRowState.Deleted) // ja Rinda nav Dzēsta
                    //{
                        if ((int)koment.Rows[b][0] == (int)koment.Rows[i][0])
                        {
                            if (b != i)
                            {
                                // atradu dublējošos Komentu Skaitu! 
                                koment.Rows[i][1] = (int)koment.Rows[i][1] + (int)koment.Rows[b][1];
                                koment.Rows[b].Delete(); // nodzēšu rindu [B]
                                koment.AcceptChanges();
                            }
                        }
                    //}
                }
            //}
        }
        RakstiDa = RakstiTa.GetData();
       // RakstsEditDs = RakstsEditTa.GetData();
       /* foreach(DataSet1.RakstiRow Rr in RakstiDa) //DataSet1.Raksti1Row Rr in  RakstsEditDs)
        {
            // Meklē komentārus šim rakstam
            foreach(DataRow Cr in koment.Rows)
            {
                if((int)Cr.ItemArray[0] == Rr.ID_name)
                {
                    int sk = Convert.ToInt32(Cr.ItemArray[1]);
                    Rr.komentSkaits = sk;
                    RakstiDa.LoadDataRow(Rr.ItemArray, true); // RakstsEditDs.LoadDataRow(Rr.ItemArray,true);
                }
            }
        }*/
        RakstiTa.Update(RakstiDa);
        RakstiTa.Fill(RakstiDa);
        //RakstsEditTa.Update(RakstsEditDs);
        //RakstsEditTa.Fill(RakstsEditDs);

        // TĀLĀK KODS KAS iziet cauri Rakstiem un saliek koment_Q 
    }
    protected void Button2KomentSkaits_Click(object sender, EventArgs e)
    {
        RakstiDa = RakstiTa.GetData();
        foreach (DataSet1.RakstiRow Rr in RakstiDa)
        {
            Rr.komentSkaits = 1;
        }
        RakstiTa.Update(RakstiDa);
        RakstiTa.Fill(RakstiDa);
    }
    protected void DDLFolders_SelectedIndexChanged(object sender, EventArgs e)
    {
        
    }
}
